home *** CD-ROM | disk | FTP | other *** search
/ How Many Bugs in a Box / How Many Bugs in a Box.cdr / bugs / act5 / 00386_Specific routines.ls < prev    next >
Encoding:
Text File  |  1995-03-28  |  6.0 KB  |  220 lines

  1. on startMovie
  2.   global fpos, blevel, numrewards, game5level, rewardcounter, jostling, thingtimes
  3.   set thingtimes to [148: [17, the number of cast "bboxinvert"], 319: [5, the number of cast "zigwilv"], 490: [17, the number of cast "bboxinvert"], 560: [5, the number of cast "zigwilv"], 752: [3, the number of cast "invswitch"], 914: [17, the number of cast "bboxinvert"]]
  4.   set jostling to [:]
  5.   repeat with xxx = 1 to PI * 4
  6.     addProp(jostling, 1 * sin(xxx / 2.0), 1 * sin((PI / 2.0) + (xxx / 2.0)))
  7.   end repeat
  8.   set blevel to game5level
  9.   set numrewards to 3
  10.   set rewardcounter to random(numrewards)
  11.   if game5level = 1 then
  12.     set blevel to 3
  13.   else
  14.     if game5level = 2 then
  15.       set blevel to 6
  16.     else
  17.       set blevel to 10
  18.     end if
  19.   end if
  20.   set fpos to [[[408, 55], [527, 104], [578, 223], [528, 341], [407, 400], [287, 341], [240, 221], [289, 104]], [[468, 67], [563, 151], [567, 282], [481, 378], [346, 392], [256, 296], [250, 165], [337, 69]]]
  21.   repeat with xxx = 7 to 14
  22.     set the visible of sprite xxx to 1
  23.   end repeat
  24.   if blevel < 6 then
  25.     set the visible of sprite 10 to 0
  26.     set the visible of sprite 14 to 0
  27.   end if
  28.   if blevel < 10 then
  29.     set the visible of sprite 8 to 0
  30.     set the visible of sprite 12 to 0
  31.   end if
  32. end
  33.  
  34. on initgame
  35.   global goalbugs, bugcount, plist, blevel, bcolor, numboxes
  36.   repeat with xxx = 7 to 14
  37.     puppetSprite(xxx, 1)
  38.     set the visible of sprite xxx to 1
  39.   end repeat
  40.   if blevel < 6 then
  41.     set the visible of sprite 10 to 0
  42.     set the visible of sprite 14 to 0
  43.   end if
  44.   if blevel < 10 then
  45.     set the visible of sprite 8 to 0
  46.     set the visible of sprite 12 to 0
  47.   end if
  48.   puppetSprite(17, 1)
  49.   puppetSprite(6, 1)
  50.   puppetSprite(21, 1)
  51.   puppetSprite(22, 1)
  52.   set plist to []
  53.   repeat with xxx = 7 to 14
  54.     add(plist, the castNum of sprite xxx)
  55.   end repeat
  56.   set numboxes to 0
  57.   sactivate(21)
  58.   sactivate(22)
  59.   buginit()
  60. end
  61.  
  62. on buginit
  63.   global bugsay
  64.   set bugsay to [0, 0, 0, 0, 0, 0, 0]
  65.   set ondeck to random(7)
  66.   set ondeckpos to [593, 437]
  67.   set the locH of sprite 22 to 695
  68.   set the castNum of sprite 22 to the number of cast ("b" & ondeck)
  69.   set the locV of sprite 22 to 437
  70. end
  71.  
  72. on bugline
  73.   global stemp, bugsay, ondeck, ondeckpos, batter, battar, emptyness, stinktime
  74.   set ondeck to random(7)
  75.   repeat while ("b" & ondeck) = the name of cast the castNum of sprite 22
  76.     set ondeck to random(7)
  77.   end repeat
  78.   set stemp to the name of cast the castNum of sprite 22 & "s"
  79.   set battar to value(char 2 of stemp)
  80.   set stinktime to the timer + (the size of cast stemp / 183)
  81.   if battar = 7 then
  82.     set stinktime to 150 + the timer
  83.   end if
  84.   if battar = 6 then
  85.     set stinktime to 270 + the timer
  86.   end if
  87.   setAt(bugsay, battar, getAt(bugsay, battar) + 1)
  88.   if getAt(bugsay, battar) > 2 then
  89.     set stemp to "not" & random(8)
  90.     set stinktime to the timer + (the size of cast stemp / 183)
  91.   end if
  92.   preLoad(cast stemp)
  93.   puppetSound(stemp)
  94.   set batter to [501, 437]
  95.   set ondeckpos to [593, 437]
  96.   smovespecial(22, 60, batter)
  97.   set emptyness to 1
  98. end
  99.  
  100. on bugline2
  101.   global stemp, bugsay, ondeck, ondeckpos, batter, battar
  102.   set temp to []
  103.   set temp to sinfo(22)
  104.   sactivate(21, temp)
  105.   set the locH of sprite 22 to 695
  106.   set the castNum of sprite 22 to the number of cast ("b" & ondeck)
  107.   smovespecial(22, 60, ondeckpos)
  108. end
  109.  
  110. on setwheel
  111.   global fpos
  112.   puppetSprite(4, 1)
  113.   sactivate(11, sinfo(17))
  114.   preLoadCast("w1", "w2")
  115.   sdeact(17)
  116.   set the visible of sprite 17 to 0
  117.   set notdone to 1
  118.   repeat while notdone = 1
  119.     repeat with xxx = 1 to 2
  120.       set the castNum of sprite 4 to the number of cast ("w" & xxx)
  121.       repeat with yyy = 1 to 8
  122.         ssetpos(yyy + 6, getAt(getAt(fpos, xxx), yyy))
  123.       end repeat
  124.       updateStage()
  125.       mydelay(30)
  126.     end repeat
  127.     set temp to sinfo(14)
  128.     repeat with xxx = 14 down to 8
  129.       sactivate(xxx, sinfo(xxx - 1))
  130.     end repeat
  131.     sactivate(7, temp)
  132.     set the castNum of sprite 4 to the number of cast "w1"
  133.     repeat with yyy = 1 to 8
  134.       ssetpos(yyy + 6, getAt(getAt(fpos, 1), yyy))
  135.     end repeat
  136.     updateStage()
  137.     if the visible of sprite 11 = 1 then
  138.       set notdone to 0
  139.     end if
  140.   end repeat
  141.   sactivate(17, sinfo(11))
  142.   set the visible of sprite 17 to 1
  143. end
  144.  
  145. on startwheel
  146.   global bugcount, goalbugs, bcolor, numboxes, blevel, numrewards, rewardcounter
  147.   if bugcount < goalbugs then
  148.     talkinghead("bug5.3")
  149.     exit
  150.   else
  151.     if (the optionDown and the controlDown) or ((blevel = 3) and (numboxes = 3)) or ((blevel = 6) and (numboxes = 5)) or (numboxes = 7) then
  152.       set rewardcounter to rewardcounter + 1
  153.       if rewardcounter > numrewards then
  154.         set rewardcounter to 1
  155.       end if
  156.       set the castNum of sprite 6 to the number of cast "num 0"
  157.       updateStage()
  158.       go("reward" & rewardcounter)
  159.       exit
  160.     end if
  161.     set numboxes to numboxes + 1
  162.     go("nextbox")
  163.   end if
  164. end
  165.  
  166. on setcount
  167.   global bugcount, goalbugs, bcolor, sayit
  168.   set bugcount to 0
  169.   set goalbugs to random(blevel)
  170.   puppetSound("Carnival short amp")
  171.   set dtime to 205
  172.   set ptime to the timer
  173.   repeat while the timer < (ptime + dtime)
  174.     set the castNum of sprite 6 to the number of cast ("num" && random(blevel))
  175.     updateStage()
  176.     mydelay(5)
  177.   end repeat
  178.   set the castNum of sprite 6 to the number of cast ("num" && goalbugs)
  179.   set sayit to "s" & goalbugs
  180.   updateStage()
  181.   set temp to sinfo(11)
  182.   set nomen to the name of cast getAt(temp, 4)
  183.   set bcolor to word 1 of nomen
  184.   setAt(temp, 4, the number of cast (word 1 of nomen && "0"))
  185.   sactivate(17, temp)
  186. end
  187.  
  188. on bugout
  189.   go("barktalk")
  190. end
  191.  
  192. on buginbox
  193.   global bugcount, goalbugs, bcolor, hominy
  194.   puppetSound("plop" & random(7))
  195.   if bugcount < goalbugs then
  196.     set bugcount to bugcount + 1
  197.     set the castNum of sprite 17 to the number of cast (bcolor && bugcount)
  198.     updateStage()
  199.     go("barktalk")
  200.     exit
  201.   end if
  202.   puppetSound(0)
  203.   set hominy to hominy + 1
  204.   if hominy > 2 then
  205.     set hominy to 1
  206.   end if
  207.   talkinghead("bug5." & hominy)
  208. end
  209.  
  210. on bugdone
  211.   setwheel()
  212.   setcount()
  213. end
  214.  
  215. on setlev param
  216.   global blevel
  217.   set blevel to param
  218.   go("start")
  219. end
  220.